class ExpensesAssignment {
  final DateTime date;
  final String expensesName;
  final String expensesType;
  final double expensesAmount;

  ExpensesAssignment(this.date, this.expensesName, this.expensesType,
      {this.expensesAmount = 0.0});

  factory ExpensesAssignment.fromJson(Map<String, dynamic> json) {
    return ExpensesAssignment(
      DateTime.parse(json['date'] as String),
      json['expensesName'],
      json['expensesType'],
      expensesAmount: (json['expensesAmount'] ?? 0).toDouble(),
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'date': date.toIso8601String(),
      'expensesName': expensesName,
      'expensesType': expensesType,
      'expensesAmount': expensesAmount,
    };
  }
}
